<template>
  <div>
    <van-nav-bar title="收藏列表" left-arrow @click-left="$router.back()" />
    <HouseItem v-for="item in collectList" :key="item.houseCode">
      <template #house-left>
        <img
          :src="`http://liufusong.top:8080${item.houseImg}`"
          alt
        />
      </template>
      <template #house-right>
        <h3>{{item.title}}</h3>
        <div class="house-ms">{{item.desc}}</div>
        <div class="house-tag">{{item.tags[0]}}</div>
        <div class="price">
          <span>{{item.price}}</span>元/月
        </div>
      </template>
    </HouseItem>
  </div>
</template>

<script>
import request from '@/utils/request'
import HouseItem from '@/components/house-item.vue'

export default {
  name: 'HaokezfMycollect',
  components: {
    HouseItem
  },

  data () {
    return {
      collectList: []
    }
  },

  mounted () {},
  created () {
    this.getCollect()
  },

  methods: {
    async getCollect () {
      try {
        const { body } = await request.get('/user/favorites')
        this.collectList = body
      } catch (err) {
        console.log(err)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
